<!doctype html>
<html>
<?php echo $this->fetch('head.html'); ?>
<style>
.none{display:none;}
</style>
<body>
<script>
var qsjia=<?php echo $this->_var['shop']['qsjia']; ?>;
</script>
  <div class="fullscreen">
  <div class="scroll_content">
    <div class="topfixed">
      <div class="t_left"><a href="/index.php" class="goBack"><i class="back"></i></a></div>
      <div class="t_main"  ><?php echo $this->_var['shop']['title']; ?></div>
      <div class="t_right"><a href="/index.php?m=ymdian&a=loudong" class="link">选楼栋</a></div>

    </div>
    <div class="paddingheight"></div>
	 <div class="flexslider">
      <?php $this->assign("ad1",M("ad")->listbyno("wap_ymdian_flash")); ?>
          <ul class="slides clearfix">
          <?php $_from = $this->_var['ad1']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
            <li><a href="<?php echo $this->_var['c']['link1']; ?>"><img class="img lazy" url="<?php echo images_site($this->_var['c']['imgurl']); ?>" width="100%"></a> </li>
          <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>  
           
          </ul>
    </div>
 
    <div class="product_sendbox clearfix">
      <div class="fl"><?php echo $this->_var['shop']['shsj']; ?>分钟<br>
        送货到寝 </div>
      <div class="fr"><?php echo $this->_var['shop']['qsjia']; ?>元<br>起送</div>
      <div class="time">营业时间：<b class="red"><?php echo $this->_var['shop']['yystart']; ?>-<?php echo $this->_var['shop']['yyend']; ?></b></div>
    </div>
    <?php echo $this->fetch('inc/shop_gonggao.html'); ?>
    <div id="posNav">
    <style>
    .global_tabs.i4 li{width:24.6%;}
    </style>
    <ul class="global_tabs clearfix " >
    <?php $_from = $this->_var['catlist']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('key', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['c']):
?>	
      <li class="<?php if ($this->_var['key'] == 1): ?>first  cur<?php elseif ($this->_var['key'] == 3): ?>last<?php endif; ?>" to="list<?php echo $this->_var['key']; ?>"><a href="#list<?php echo $this->_var['key']; ?>"><?php echo $this->_var['c']; ?></a></li>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>   
     
    </ul>
    </div>
    <?php $this->assign("products",M("ymdian_product")->lsitByShopCat("".$this->_var["shop"]["id"]."")); ?>
    <?php $this->assign("cart",M("ymdian_order_cart")->getListByUser(" AND shopid=".$this->_var["shop"]["id"]."")); ?>
    <div class="product_list" id="product_list">
       <ul class="list  clearfix">
      	<?php $_from = $this->_var['products']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('k', 'cc');if (count($_from)):
    foreach ($_from AS $this->_var['k'] => $this->_var['cc']):
?>
		<?php if (empty ( $this->_var['cc'] )): ?>
        <li  id="list<?php echo $this->_var['k']; ?>" style="display:block;width:0px; height:0px; float:left;"></li>
        <?php endif; ?>       
        <?php $_from = $this->_var['cc']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('kk', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['kk'] => $this->_var['c']):
?>
        <li class="cat<?php echo $this->_var['k']; ?> li">
          <p class="imgResize"><a href="javascript:;"><img url="<?php echo images_site($this->_var['c']['imgurl']); ?>.middle.jpg" class="img lazy"></a></p>
          <p class="tit"><?php echo $this->_var['c']['title']; ?> <?php if ($this->_var['kk'] == 0): ?><span id="list<?php echo $this->_var['k']; ?>" style="display:block;width:1px; height:1px; float:left;"></span><?php endif; ?></p>
          <div class="num"><span class="fl"><del>￥<?php echo $this->_var['c']['market_price']; ?></del></span><span class="fr">已售<?php echo $this->_var['c']['buy_num']; ?>份</span></div>
          <div class="pricebox">
            <div class="price"><b class="red">￥<?php if ($this->_var['c']['lower_price'] > 0): ?><?php echo $this->_var['c']['lower_price']; ?><?php else: ?><?php echo $this->_var['c']['price']; ?><?php endif; ?></b></div>
            <div class="showcart">
            <?php if ($this->_var['c']['total_num'] <= 0): ?>
            已售罄
            <?php else: ?>
              <div class="cart_icon <?php if ($this->_var['cart'] [ product ] [ $this->_var['c'] [ id ] ]): ?>none<?php endif; ?>"></div>
              <div class="cart_num" <?php if ($this->_var['cart'] [ product ] [ $this->_var['c'] [ id ] ]): ?> style="display:block;"<?php endif; ?> object_id="<?php echo $this->_var['c']['id']; ?>" shopid="<?php echo $this->_var['c']['shopid']; ?>" productid="<?php echo $this->_var['c']['productid']; ?>">
              <a class="Decrease" href="javascript:void(0)"><i>-</i></a>
              <input class="Amount" value="<?php echo intval($this->_var['cart'][product][$this->_var['c'][id]][amount]); ?>" autocomplete="off" maxlength="3">
              <a class="Increase" href="javascript:void(0)"><i>+</i></a>
         	</div>
            <?php endif; ?>
            </div>
          </div>
        </li> 
        
        
        
        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        
          <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
      </ul>
    </div>
 
    
    
  </div>
</div>

 <div class="bottom_cartfixed">
  <div class="cart " > <i id="end"></i> </div>
  <div class="info" id="shopCart"> 您一共添加了<span class="num" id="cart_num"><?php echo intval($this->_var['cart']['total_num']); ?></span> 件商品<br>
    合计：<b class="num" id="cart_total_money"><?php echo intval($this->_var['cart']['total_money']); ?></b>元 
     
    </div>
    
    <a href="javascript:;" style="<?php if ($this->_var['cart']['total_money'] > $this->_var['shop']['qsjia']): ?> display:none<?php endif; ?>" id="shop_lt_qsjia" class="btn"><?php echo $this->_var['shop']['qsjia']; ?>元起送</a>
    
    <a href="/index.php?m=cart"  style="<?php if ($this->_var['cart']['total_money'] <= $this->_var['shop']['qsjia']): ?> display:none<?php endif; ?>" id="shop_gt_qsjia" class="btn">去结算</a>
    
    
    
</div>
<div id="flyItem" class="fly_item" ><img class="lazy" url="<?php echo $this->_var['skins']; ?>img/profile-80.jpg" width="40" height="40"></div>
<script src="<?php echo $this->_var['skins']; ?>js/parabola.js"></script>
<script src="<?php echo $this->_var['skins']; ?>js/ymdian_cart.js"></script>
<style>
.fix{position:fixed;top:50px; left:1px; right:0px;}
.fix  .global_tabs{margin:0 auto;}
.fix li{background-color:#fff;}
</style>
<script>
imgLazy("body");
loadjs(basejs,function(){
		 $(".flexslider").flexslider({
		 	slideshowSpeed: 3000
		 });
}) 
// 元素以及其他一些变量
var eleFlyElement = document.querySelector("#flyItem"), eleShopCart = document.querySelector("#shopCart");
 
// 抛物线运动
var myParabola = funParabola(eleFlyElement, eleShopCart, {
	speed: 400, //抛物线速度
	curvature: 0.0008, //控制抛物线弧度
	complete: function() {
		eleFlyElement.style.visibility = "hidden";
		
	}
});

var fix=0;
var show=1;
var lastTop=0;
var it;
var it_i=0;

 
 
function scrollNavFix(){
	var st=$(window).scrollTop();
	console.log(st);
	if(st==lastTop){
		return false;
	}
	lastTop=st;
	var winH=$(window).height();
	var H1=$("#list1").offset().top - st;
	var H2=$("#list2").offset().top - st;
	var H3=$("#list3").offset().top - st;
	
	if(H1>50 && H1<winH){
		show=1;
	}else if(H2>50 && H2<winH){
		show=2;
		console.log(show);
	}else if(winH>H3 && H3>100){
		show=3;
	}
	
	$(".global_tabs li").removeClass("cur");
	$(".global_tabs li").eq((show-1)).addClass("cur");
	if(st>50){
		if(fix==0){
			$("#posNav").addClass("fix");
			fix=1;
		}
		
	}else{
		if(fix==1){
			$("#posNav").removeClass("fix");
			fix=0;
		
		}
		
	}
}

$(window).scroll(function(e){
	scrollNavFix();
})
imgResize(240,240);
 $(window).resize(function(){
	 imgResize(240,240);
 })
//选项卡
$(".global_tabs li").click(function(e) {
    $(this).addClass("cur").siblings().removeClass("cur");
	/*
	$("#product_list .list").addClass("none");
	$("#"+$(this).attr("to")).removeClass("none");
	*/
});
//
$("#product_list .list:eq(0) .li:odd").css("margin-left","2%");
$("#product_list .list:eq(1) .li:odd").css("margin-left","2%");
$("#product_list .list:eq(2) .li:odd").css("margin-left","2%");
//购物车，显示加减模板
$(".product_list .cart_icon").click(function(e) {
	
    $(this).fadeOut(10).next(".cart_num").fadeIn("fast");
	$(this).parents(".showcart").find(".Increase").trigger("click");
});
</script>

 

 <?php echo $this->fetch('footer.html'); ?>
 <script src="/module.php?m=kefu&a=js&tablename=ymdian&shopid=<?php echo $this->_var['shop']['id']; ?>"></script>
</body>
</html>
